import { legacy_createStore, combineReducers, compose, applyMiddleware } from "redux"
import reduxThunk from 'redux-thunk'

import handleUser from './UserStates/reducer'

//combineReducers--->组合各个模块的reducer
const reducers = combineReducers({
  handleUser
})
// window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__() 是为了让浏览器正常使用redux
// const store = legacy_createStore(reducers,window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__())

let composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({}) : compose
const store = legacy_createStore(reducers, composeEnhancers(applyMiddleware(reduxThunk)))

export default store